1. Field of the Invention
The present invention relates to an image processing apparatus, an image processing program product and an image pick-up apparatus. More specifically, the present invention relates to an image processing apparatus, an image processing program product and an image pick-up apparatus that are capable of extracting edge portions with high precision.
2. Description of the Related Art
Conventionally, a technique has been proposed in which each pixel of an image prepared by extracting edge components from an image input through a camera or the like (hereinafter referred to as an edge image) is compared in magnitude with a threshold value set in advance, to form an image having edge portions and non-edge portions distinguished from each other (hereinafter referred to as an edge binarized image). When the threshold value is set large in such a technique, it becomes difficult to extract a portion that is desirable to be extracted as the edge portion, if that portion is a thin line with small gradation difference. On the contrary, when the threshold value is set small, it becomes possible to extract that portion of the input image which has small gradation difference. However, it becomes more likely that edge components that exist around the original edge component that has been successfully extracted are undesirably extracted as edge portions as well, resulting in an edge portion that is too thick. Further, there is a higher possibility that not only a thin line but also noise components would undesirably be extracted. Thus, it has been very difficult to determine a right threshold value that can simultaneously solve both of the above described problems.
Japanese Laid-Open Patent Publication No. 2000-13607 discloses an image processing method in which an image prepared by smoothing an input image (hereinafter referred to as a smoothed image) is subtracted from the input image, an edge component is extracted based on the result of subtraction, and the edge component is binarized by using a prescribed threshold value, whereby an edge portion and a non-edge portion are distinguished from each other.
The image processing method disclosed in Japanese Laid-Open Patent Publication No. 2000-13607 will be specifically described.
FIG. 9 represents an image A-1 having large gradation difference, an image B-1 having a small gradation difference, and an image C-1 having moderate gradation with the gradation difference changing like a wave. According to the image processing method disclosed in Japanese Laid-Open Patent Publication No. 2000-13607, first, the input images are smoothed using an average filter. Edge smoothed images A-2, B-2 and C-2 obtained by averaging the input images of FIG. 9 by taking 7 pixels by 7 pixels are shown in FIG. 10.
Thereafter, according to the image processing method disclosed in Japanese Laid-Open Patent Publication No. 2000-13607, difference between the input image (or the image for outline extraction) and the smoothed image is calculated. Results of subtraction A-3, B-3 and C-3 of smoothed images A-2, B-2 and C-2 shown in FIG. 10 from the input images A-1, B-1 and C-1 shown in FIG. 9 are shown in FIG. 11.
Japanese Laid-Open Patent Publication No. 2002-175534 discloses a method in which an edge image is formed from, an input image, and using an average value and standard deviation of the edge component of the edge image, an edge binarized image is formed.
The method disclosed in Japanese Laid-Open Patent Publication No. 2000-13607 has a problem that when there is a portion having wave-like gradation difference where the gradation changes moderately, the peak portion of the wave that should not be extracted as an edge is undesirably extracted as an edge portion. More specifically, in the method disclosed in Japanese Laid-Open Patent Publication No. 2000-13607, the portion {circle around (7)} is extracted as the edge portion based on the result of subtraction B-3 shown in FIG. 11, and therefore, when the threshold value is set to 8 as an example, portions {circle around (7)} and {circle around (8)} of input image A-1 would be extracted as the edge portion based on the result of subtraction A-3. Thus, the extracted edge portion becomes rather thick. When the edge portion is detected thick, it becomes sometimes difficult to detect accurate position of an object. Further, in the result of subtraction C-3, values of portions {circle around (5)} to {circle around (7)} are higher than the threshold value 8, and therefore, these portions in input image C-1 are undesirably extracted as the edge portion, though these portions actually have the wave-like gradation difference with moderately changing gradation.
The method disclosed in Japanese Laid-Open Patent Publication No. 2002-175534 also has a problem that it is difficult to extract, as an edge portion, a portion having small gradation difference such as a thin line existing in an input image of which portions mostly have large gradation difference.